package it.ipermemory.utilities;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * Allows you to manage network services.
 * 
 * @author Gianluca Carlesso (gianluca.carlesso@gmail.com)
 * @version 1.0
 * 
 */
public class NetworkService {

	/**
	 * Check network connection
	 * 
	 * @param context
	 *            of application
	 * @return Boolean true if there is a network connection, false otherwise
	 */
	public static boolean checkNetworkConnection(Context context) {
		ConnectivityManager connMgr = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);

		NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();

		return networkInfo != null && networkInfo.isConnected();
	}
}
